﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Universum.Infrastructure.Persistence;
using Universum.Model.Domain.Feedbacks;

namespace Universum.Model.Services.Feedbacks
{
	public class FeedbackServiceImpl : IFeedbackService
	{
			IRepository _Repository;
			public FeedbackServiceImpl(IRepository repository)
		{
			_Repository = repository;
		}
		public void Register(Universum.Model.Domain.Feedbacks.Feedback feedback)
		{
			_Repository.SaveOrUpdate(feedback);
		}

		#region IFeedbackService Members


		public List<Universum.Model.Domain.Feedbacks.Feedback> GetAllFeedbacks()
		{
			return _Repository.Query<Universum.Model.Domain.Feedbacks.Feedback>().ToList();
		}

		#endregion

		#region IFeedbackService Members


		public void RemoveFeedback(Guid id)
		{
			var feedbackEntity = _Repository.Load<Feedback>(id);
			if(feedbackEntity.IsNotNull())
				_Repository.Remove(feedbackEntity);
		}

		#endregion
	}
}
